import { get, post, put, del } from '@/utils/http/request'
import { R, P } from '@/utils/http/type'
import {
  CityListType,
  MenuListType,
  ShopInfoType,
  UserShopType,
  QualificationType,
  merchantInfo,
  DictionariesType,
} from './types/register'
export * from './types/register'

/**
 * 获取商户信息证件类型
 * @param mark
 * @returns
 */
export const getIdCard = (mark = 'id_card') => {
  return get<R<DictionariesType[]>>(
    `http://43.139.98.171:3003/seller/base/dictionary/list`,
    {
      mark,
    }
  )
}

/**
 * 获取行业证件类型
 * @param mark
 * @returns
 */
export const getIndustryQualification = (mark = 'industryQualification') => {
  return get<R<DictionariesType[]>>(
    `http://43.139.98.171:3003/seller/base/dictionary/list`,
    {
      mark,
    }
  )
}

/**
 * 获取主体证件类型
 * @param mark
 * @returns
 */
export const getSubjectQualification = (mark = 'subjectQualification') => {
  return get<R<DictionariesType[]>>(
    `http://43.139.98.171:3003/seller/base/dictionary/list`,
    {
      mark,
    }
  )
}

/**
 * 获取商户信息
 * @param storeId
 * @returns
 */
export const getShopInfo = (storeId: string) => {
  return get(
    `http://43.139.98.171:3003/seller/shop/store/registry/sellerInfo/detail/${storeId}`
  )
}
/**
 * 提交商户信息
 * @param item
 * @returns
 */
export const submitShopInfo = (item: merchantInfo) => {
  return post(
    'http://43.139.98.171:3003/seller/shop/store/registry/sellerInfo',
    item
  )
}

export const getQualificationInfo = (storeId: string) => {
  return get<R<QualificationType>>(
    `http://43.139.98.171:3003/seller/shop/store/registry/qualification/detail/${storeId}`
  )
}

/**
 * 资质信息提交
 * @param item
 * @returns
 */
export const submitQualification = (item: QualificationType) => {
  return post(
    'http://43.139.98.171:3003/seller/shop/store/registry/qualification',
    item
  )
}

/**
 * 获取当前用户下的商店
 * @returns
 */
export const getUserShop = () => {
  return get<R<UserShopType>>(
    'http://43.139.98.171:3003/seller/shop/store/registry/user/store/list'
  )
}

/**
 * 获取门店信息详情
 * @param storeId
 * @returns
 */
export const getBaseInfo = (storeId: string) => {
  return get(
    `http://43.139.98.171:3003/seller/shop/store/registry/baseInfo/detail/${storeId}`
  )
}

/**
 * 门店信息收集
 * @param item
 * @returns
 */
export const submitBaseInfo = (item: ShopInfoType) => {
  return post(
    'http://43.139.98.171:3003/seller/shop/store/registry/baseInfo',
    item
  )
}

/**
 * 获取菜单详情
 * @returns
 */
export const GetMenuDetail = () => {
  return get<R<MenuListType>>('/goods/category/cascader')
}

/**
 * 获取城市详情
 * @returns
 */
export const GetCityDetail = () => {
  return get<R<CityListType>>('/shop/store/area/tree')
}
